package entities;

import java.io.Serializable;
import javax.persistence.*;

import java.util.List;

/**
 * The persistent class for the patient_detail database table.
 * 
 */
@Entity
@Table(name = "patient_detail")
public class PatientDetail implements Serializable {
	private static final long serialVersionUID = 1L;
	private int idPatientDetail;
	private String address;
	private String emgContact;
	private String firstName;
	private String lastName;
	private User user;
	private List<ExamineDetail> examineDetails;

	public PatientDetail() {
	}

	public PatientDetail(String address, String emgContact, String firstName, String lastName,
			User user) {
		super();
		this.address = address;
		this.emgContact = emgContact;
		this.firstName = firstName;
		this.lastName = lastName;
		this.user = user;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(unique = true, nullable = false)
	public int getIdPatientDetail() {
		return this.idPatientDetail;
	}

	public void setIdPatientDetail(int idPatientDetail) {
		this.idPatientDetail = idPatientDetail;
	}

	@Column(nullable = false, length = 200)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(length = 200)
	public String getEmgContact() {
		return this.emgContact;
	}

	public void setEmgContact(String emgContact) {
		this.emgContact = emgContact;
	}

	@Column(nullable = false, length = 50)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(nullable = false, length = 50)
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@ManyToOne
	@JoinColumn(name = "idUser", nullable = false)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	// bi-directional many-to-one association to ExamineDetail
	@OneToMany(mappedBy = "patientDetail", fetch = FetchType.EAGER)
	public List<ExamineDetail> getExamineDetails() {
		return this.examineDetails;
	}

	public void setExamineDetails(List<ExamineDetail> examineDetails) {
		this.examineDetails = examineDetails;
	}

	@Override
	public String toString() {
		return this.getClass().getName() + "[ " + idPatientDetail + " | " + address + " | "
				+ emgContact + " | " + firstName + " | " + lastName + " ]";
	}

	

}